FROM php:7.1-fpm
COPY docker.conf /usr/local/etc/php-fpm.d/docker.conf

RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list  && \
    apt-get update && apt-get upgrade  && apt-get install -y \
        libfreetype6-dev \
        libjpeg62-turbo-dev \
        libmcrypt-dev \
#        libpng12-dev \
        librecode-dev \
        libbz2-dev \
    && pecl channel-update pecl.php.net \
#    && pecl install xdebug-2.5.5 \
#    && pecl install -o -f redis  \
    && rm -rf /tmp/pear \
#    && docker-php-ext-enable xdebug \
    && docker-php-ext-configure mysqli --with-mysqli=mysqlnd \
    && docker-php-ext-configure pdo_mysql  --with-pdo-mysql=mysqlnd \
    && docker-php-ext-install -j$(nproc) iconv mcrypt recode mysqli pdo_mysql opcache zip mbstring opcache \
    && docker-php-ext-configure gd \
            --enable-gd-native-ttf \
            --with-freetype-dir=/usr/include/freetype2 \
            --with-png-dir=/usr/include \
            --with-jpeg-dir=/usr/include \
    && docker-php-ext-install gd \
    && docker-php-ext-enable gd


RUN apt-get clean && \
    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
    rm /var/log/lastlog /var/log/faillog


COPY php.ini /usr/local/etc/php/conf.d/docker-php-ext-php.ini
COPY opcache.ini /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
#COPY xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini